package cn.itzzx.lagou.mybatis.session;

import cn.itzzx.lagou.mybatis.pojo.Configuration;
import cn.itzzx.lagou.mybatis.pojo.MappedStatement;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

/**
 * TODO 写点注视啦
 *
 * @author Martin
 * @date 2020-04-25
 * @see 1.0
 */
public interface Executor {

    /**
     * 执行查询Sql
     * @param configuration
     * @param mappedStatement
     * @param params
     * @param <E>
     * @return
     */
    <E> List<E> query(Configuration configuration,MappedStatement mappedStatement,Object...params) throws SQLException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, IntrospectionException;


    /**
     * 执行 新增 / 修改 /删除操作 具体操作根据  MappedStatement 中的 operation 属性决定
     * @param configuration
     * @param mappedStatement
     * @param params
     * @return
     */
    int update(Configuration configuration,MappedStatement mappedStatement,Object...params)throws Exception;
}
